package com.xujianlun.cpms.mapper.sys;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xujianlun.cpms.dto.UserPassWordDto;
import com.xujianlun.cpms.entity.shop.Carts;
import com.xujianlun.cpms.entity.sys.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 用户信息表 Mapper 接口
 * </p>
 *
 * @author xujianlun
 * @since 2022-11-14
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Update("update sys_user set pass_word = #{newPassWord} where user_name = #{userName} and pass_word = #{passWord}")
    int updatePassword(UserPassWordDto userPassWordDto);

    @Select("select user_name,email from user where email = #{email} and user_name = #{userName}")
    int findUser(String email, String userName);

    @Update("update sys_user set pass_word = #{passWord} where user_name = #{userName} and email = #{email}")
    int updatePasswordByEmailUserName(@Param("email") String email, @Param("passWord") String passWord, @Param("userName") String userName);

    Page<User> getSchoolPage(Page<User> userPage,@Param("nickName") String nickName,@Param("phone") String phone, @Param("address") String address, @Param("local") String local,@Param("localName") String localName);
}
